<?php

session_start();
 $uname = $_POST['uname'];
 $password = $_POST['password'];

 if ($uname&&$password)
 {

	 $connect = mysql_connect("localhost","root","") or die ("could'nt connect to db");
 	 mysql_select_db("business-is") or die ("can't connect");
	 $queryget= mysql_query("SELECT * FROM user WHERE uname='$uname'");
	 $querygetrownum=mysql_num_rows($queryget);
	 if($querygetrownum !=0 )

	 {

	while($row=mysql_fetch_assoc($queryget))
	 {
	$dbusername = $row['uname'];
	$dbpassword = $row['password'];
	}
	if ($uname==$dbusername&&$password==$dbpassword)

	{

	header('Location: index3.php');
		$_SESSION['uname']=$dbusername;


	}
	else{
	header('Location: Loginattempt1.php');
		$_SESSION['uname']=$dbusername;}
		}

 	else{
	header('Location: Loginattempt2.php');
		$_SESSION['uname']=$dbusername;}

 }
 	else{
	header('Location: Loginattempt3.php');
		$_SESSION['uname']=$dbusername;
}
?>